#ifndef ADCDRIVER1_H_
#define ADCDRIVER1_H_

#include "DSP2833x_Device.h"

class ADCDriver1
{
public:
	enum Channels { RotX = 0, RotY = 1, RotZ = 2, Pressure1 = 3, Pressure2 = 4, None = 5, Temp=6, Power5V=7 }; 

public:
	bool Init();
	void Update();
	float GetValue(Channels channel);
	unsigned char GetStatus();

private:
	void SetupSPI();
	unsigned char WriteByte(unsigned char data);
	void Reset();
	unsigned char ReadID();
	void BeginConversion(Channels channel, int gain, bool useRef2, bool bipolar);  // GAIN: 0->1, 1->2, 2->4, 3->8, 4->16, 5->32, 6->64, 7->128
	bool ConversionIsDone(); 
	Uint32 GetResult();
	unsigned char ReadStatusReg();

private:
	int m_currentChannel;

	unsigned char m_statusByte;

	// channels
	float m_Channels[8];
};


#endif /*ADCDRIVER1_H_*/
